<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.HistResolucaoRelatorioAtividadesTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <p:growl id="messages" life="3000"/>

            <h:panelGroup id="messagePanel" styleClass="ajustaListaMensagemErro"  layout="block" >
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="list" />
            </h:panelGroup>

            <p:panel>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.ListHistResolucaoTitle_dataInicial}" for="dataInicial"/>
                    <h:panelGroup>

                        <p:calendar id="dataInicial" onkeyup="formatar(this, '##/##/####');" maxdate="#{bundle.maxDateCalendar}" value="#{relatorioAtividadesController.dataInicial}" required="true" requiredMessage="#{bundle.ListHistResolucaoRequiredMessage_dataInicial}" locale="#{bundle.localeApp}" size="18" maxlength="10" navigator="true" showOn="button" pattern="#{bundle.patternApp}">
                            <f:convertDateTime for="dataInicial" pattern="#{bundle.patternApp}" timeZone="#{filterSearchController.timeZone}"/>
                        </p:calendar>&nbsp;

                        <h:outputLabel value="#{bundle.ListHistResolucaoTitle_dataFinal}" for="dataFinal"/>
                        <p:calendar id="dataFinal" onkeyup="formatar(this, '##/##/####');" maxdate="#{bundle.maxDateCalendar}" value="#{relatorioAtividadesController.dataFinal}" required="true" requiredMessage="#{bundle.ListHistResolucaoRequiredMessage_dataFinal}" locale="#{bundle.localeApp}" size="18" maxlength="10" navigator="true" showOn="button" pattern="#{bundle.patternApp}">
                            <f:convertDateTime for="dataFinal" pattern="#{bundle.patternApp}" timeZone="#{filterSearchController.timeZone}"/>
                        </p:calendar>

                        <p:commandButton id="downloadLink" ajax="false" icon="#{bundle.icone_checar}" update=":formList:tbl" value="#{bundle.ListHistResolucaoButton_gerarRelatorio}" action="#{relatorioAtividadesController.gerarRelatorio()}"  />

                    </h:panelGroup>                    

                    <ui:remove>
                        <h:outputLabel value="#{bundle.ListHistResolucaoTitle_hreUreId}" for="usuarios"/>
                        <p:selectOneMenu id="usuarios" value="#{relatorioAtividadesController.usuario}" filter="true">
                            <f:selectItems id="select_usuarios" value="#{usuarioController.itemsAvailableSelectOne}"/>
                        </p:selectOneMenu>   
                    </ui:remove>
                </h:panelGrid>


            </p:panel>
            <p:panel>

                <p:dataTable  id="tbl" value="#{relatorioAtividadesController.lista}" var="item"  paginator="true" rows="#{bundle.rows}" pageLinks="5"
                              paginatorTemplate="#{bundle.paginatorTemplate}" currentPageReportTemplate="#{bundle.currentPageReportTemplateAtividades}"
                              rowsPerPageTemplate="#{bundle.rowsPerPageTemplate}"  paginatorPosition="#{bundle.paginatorPosition}"  
                              emptyMessage="#{bundle.ListHistResolucaoTitle_emptyMessage}" 
                              >

                    <p:column  filterBy="#{item.usuNome}"  sortBy="#{item.usuNome}" exportable="true">
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListHistResolucaoTitle_hreUreId}"/>
                        </f:facet>
                        <h:outputText value="#{item.usuNome}"/>
                    </p:column>
                    <p:column   filterBy="#{item.flagAcao}" sortBy="#{item.flagAcao}" exportable="true">
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListHistResolucaoTitle_acao}"/>
                        </f:facet>
                        <h:outputText value="#{item.flagAcao}"/>
                    </p:column>
                    <p:column  filterBy="#{item.dataAcao}" sortBy="#{item.dataAcao}" exportable="true">
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListHistResolucaoTitle_hreDtOperacao}"/>
                        </f:facet>
                        <h:outputText value="#{item.dataAcao}">
                            <f:convertDateTime for="dataFinal" pattern="#{bundle.patternAppDataHora}" timeZone="#{filterSearchController.timeZone}"/>
                        </h:outputText>
                    </p:column>
                    <p:column filterBy="#{item.entidade}" sortBy="#{item.entidade}" exportable="true">
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListHistResolucaoTitle_entidade}"/>
                        </f:facet>
                        <h:outputText value="#{item.entidade}"/>
                    </p:column>   
                    <p:column  sortBy="#{item.descAcao}" style="display: none;" exportable="true">
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListHistResolucaoTitle_acao}"/>
                        </f:facet>
                        <h:outputText value="#{item.descAcao}"/>
                    </p:column>  

                    <f:facet name="footer">                        
                        <p:commandButton id="excelExportAll" ajax="false" value="#{bundle.excelExportAll}" icon="#{bundle.icone_script}">
                            <p:dataExporter  type="xls" target="tbl" fileName="#{bundle.excelExportAllFileName_atividades}" postProcessor="#{filterSearchController.postProcessorXLS}"/>
                        </p:commandButton>                    
                    </f:facet>

                </p:dataTable>

            </p:panel>
        </ui:define>
    </ui:composition>
</html>